﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/view.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Workflow.Common.Tools" %>
<%@ Import Namespace="Workflow.Model.Enum" %>
<%@ Import Namespace="Workflow.Resource" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function report() {


            $('#form').form('submit', {
                url: '/Report/ShowEEMReport',
                success: function (data) {
                    eval('data=' + data);
                    if (data.Success) {

                    } else {
                        $.messager.alert('<%=Global.ErrorTitle%>', data.Message, 'error');

                    }

                },
                onSubmit: function () {
                    //if (_user_form.valid())
                    var DateFrom = $('#DateFrom').datebox('getValue');
                    var DateTo = $('#DateTo').datebox('getValue');
                    if (DateFrom == "" || DateTo == "") {
                        return false;
                    }
                    return true;
                    // else
                    //    return false;
                }
            });

        }

        $(function () {

            $('#DateFrom').datebox({
                formatter: function (date) { return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate(); },
                parser: function (date) { return new Date(Date.parse(date.replace(/-/g, "/"))); }
            });
            $('#DateTo').datebox({
                formatter: function (date) { return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate(); },
                parser: function (date) { return new Date(Date.parse(date.replace(/-/g, "/"))); }
            });

            $('#FolderLevelA').combobox({ url: '<%= Url.Action("GetFolderLevel","GPEEM",new{id=2})%>',
                valueField: 'FolderCode',
                textField: 'FolderName',
                onSelect: function (node) {
                    // alert(node.FolderCode);
                    $('#FolderLevelB').combobox({
                        disabled: false,
                        url: '/MSDEEM/GetClassA?id=' + node.FolderCode,
                        valueField: 'FolderCode',
                        textField: 'FolderName'
                    });
                }
            });

            $("#ReportType").bind({
                change: function () {
                    var value = $('#ReportType').val();
                    if (value == '6') {

                        $("#folder").css("display", "inline");
                    }
                    else {
                        $("#folder").css("display", "none");
                    }
                }
            });
        });

       
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <% using (Html.BeginForm("ShowEEMReport", "Report", FormMethod.Post,
                          new { name = "form", id = "form" }))
       {%>
    <div class="easyui-panel">
        <div class="panel-header">
            <%=Global.EEMReport%></div>
        <div class="panel-body">
            <%=Global.dateFrom%>
            :
            <input class="easyui-datebox" id="DateFrom" name="DateFrom" style="width: 100px"
                value="<%=ToolsHelper.GetTimeZoneNow().ToString("yyyy/MM/dd") %>">
            <%=Global.dateTo%>:
            <input class="easyui-datebox" id="DateTo" name="DateTo" style="width: 100px" value="<%=ToolsHelper.GetTimeZoneNow().ToString("yyyy/MM/dd") %>">
            <select class="easyui-combo" id="ReportType" name="ReportType">
                <%
                    int groupCode = (int)ViewData["GroupCode"];
                    if (groupCode == (int)EnumGroup.GPAHPTP
                        || groupCode == (int)EnumGroup.GPAHEEM
                        || groupCode == (int)EnumGroup.GPPTP
                        || groupCode == (int)EnumGroup.GPEEM
                        || groupCode == (int)EnumGroup.GPMDM)
                    {
                %>
                <option value="3">伝票タイプ別件数－日</option>
                <option value="4">伝票タイプ別件数－月</option>
                <option value="5">担当者別月件数</option>
                <option value="2">First Pass Yeild</option>
                <option value="1">Cycle Time</option>
                 <option value="6">理由別件数</option>
                <% 
                    }
                    if (groupCode == (int)EnumGroup.MSDAHPTP
                        || groupCode == (int)EnumGroup.MSDAHEEM
                        || groupCode == (int)EnumGroup.MSDPTP
                        || groupCode == (int)EnumGroup.MSDEEM
                        || groupCode == (int)EnumGroup.MSDMDM)
                    {
                %>
                <option value="3">伝票タイプ別件数－日</option>
                <option value="4">伝票タイプ別件数－月</option>
                <option value="2">First Pass Yeild</option>
                <option value="1">Cycle Time</option>
                 <option value="6">理由別件数</option>
                <%  
                    }
                %>
            </select>
            <div id="folder"  style="display:none">
             <%=Global.FolderLevelA%>:
                <input id="FolderLevelA" name="FolderLevelA" class="easyui-combobox" style="width: 100px" valuefield="FolderCode"
                    textfield="FolderName" multiple="false" editable="false">
                     <%=Global.FolderLevelB%>:
                <input id="FolderLevelB" name="FolderLevelB" class="easyui-combobox" style="width: 100px" valuefield="FolderCode"
                    textfield="FolderName" multiple="false" editable="false" disabled="true">
             </div>
            <a href="#" class="easyui-linkbutton" iconcls="icon-redo" plain="true" onclick="report();">
                <%=Global.Export%></a></div>
                
    </div>
    <%
        }%>
       
</asp:Content>
